﻿@using KRM.Core
@model KRM.Core.tblOrderItem
@{
    ViewBag.Title = "PRE-RDM NON FAC CHECKLIST";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
    var hasPhoto = new KRMEntities().tblOrderItemPhotos.Any(a => a.OrderItemID == Model.OrderItemID);
}
<script>
    function missingrequired(reasonid) {
        if (reasonid == 23) {
            $("#PhotosOrPictureComments").attr("required", "required");
            $(".showphoto").show();
        } else {
            $("#PhotosOrPictureComments").removeAttr("required");
            $(".showphoto").hide();
        }
    }
</script>
<div style="padding: 20px; font-size: 12px">
    <form action="/rdm/addquestionnairenonfac" method="POST" class="addquestionnairenonfac">
        @Html.Partial("Partial/_MessageResult")
        <input type="hidden" value="@Model.OrderItemID" id="OrderItemID" name="OrderItemID"/>
        <input type="hidden" value="@Model.Order.OrderRef" name="OrderRef"/>
        <div class="row-fluid">
            <p>To add an RDM for a : @Model.ProductOption please fill in the following check list and Pre-RDM Questionnaire:</p>
        </div>
        <div class="row-fluid">
            <div class="span1">1</div>
            <div class="span3">Reason</div>
            <div class="span5">
                @Html.DropDownList("ReasonID", null, "--Please select--", new { required = "required", onchange = "missingrequired(this.value)" })
            </div>
            <div class="span3 showphoto" style="display: none; font-weight: bold">
                @if (hasPhoto)
                {
                    <a href="/orderview/viewphoto?orderitemid=@Model.OrderItemID" target="_blank">See photos</a>
                }
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1">2</div>
            <div class="span3">Reason detail</div>
            <div class="span5">
                <select name="ReasonDetailID" required="required" id="ReasonDetailID">
                    <option>--Please select--</option>
                </select>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1">3</div>
            <div class="span11">
                <input type="checkbox" name="IsCheckedAllParts" value="True" class="pull-left" style="margin-right: 7px" required="required" />
                I have asked the customer  to check through all parts
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1"></div>
            <div class="span11">
                <div class="span2">Comment</div>
                <div class="span10">
                    <textarea style="width: 96%" name="CheckedAllPartsComments"></textarea>
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1">4</div>
            <div class="span11">
                <input type="checkbox" name="IsAskedConditionOfTheBox" value="True" class="pull-left" style="margin-right: 7px" required="required" />
                Asked the customers regarding the condition of the Box
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1"></div>
            <div class="span11">
                <div class="span2">Comment</div>
                <div class="span10">
                    <textarea style="width: 96%" name="AskedConditionOfTheBoxComments"></textarea>
                </div>
            </div>
        </div>

        <div class="row-fluid">
            <div class="span1">5</div>
            <div class="span11">
                <input type="checkbox" name="IsCheckedPOD" value="True" class="pull-left" style="margin-right: 7px" required="required" />
                I haved checked POD
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1"></div>
            <div class="span11">
                <div class="span2"></div>
                <div class="span10">
                    @Html.DropDownList("SignatureID", null, "--Please select--", new { required = "required" })
                </div>
            </div>
        </div>

        <div class="row-fluid">
            <div class="span1">6</div>
            <div class="span11">
                <input type="checkbox" name="IsCheckedPhotoOrPicture" value="True" class="pull-left" style="margin-right: 7px" required="required" />
                I have checked a photos / pictures
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1"></div>
            <div class="span11">
                <div class="span2">Comment</div>
                <div class="span10">
                    <textarea style="width: 96%" name="PhotosOrPictureComments" id="PhotosOrPictureComments"></textarea>
                </div>
            </div>
        </div>

        <div class="row-fluid">
            <div class="span1">7</div>
            <div class="span11">
                Other comment:
            </div>
        </div>
        <div class="row-fluid">
            <div class="span1"></div>
            <div class="span11">
                <textarea style="width: 96%" name="OtherComments"></textarea>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span12 text-center" style="margin-top: 10px">
                <input type="button" class="btn  btn-primary btn-issueresolvenonfac" value="Issue Resolvel" />
                <input type="button" value="Generate RDM" class="btn btn-primary btn-generaterdmnon" />
                <input type="submit" value="Save" class="btn btn-primary " />
                <button class="btn" type="button" onclick="javascript:window.close();" style="margin-left: 20px">Cancel</button>
            </div>
        </div>
    </form>
</div>
